<?php use_helper('Number') ?>

<?php if ($receipt):?>

<div class="center_title">
    <?php echo __('Cart created at') ?> <?php echo $receipt->getCreatedAt() ?>
</div>

<div class="center_text">
    <div class="text_item">
    <?php $i = 1; ?>
    <?php if ( $receipt->getReceiptItemsQnt() > 0 ): ?>
    <table class="cart" cellpadding="2" cellspacing="1" width="100%">
        <tr>
            <th width="5%"><?php echo __('No.'); ?></th>
            <th width="15%"><?php echo __('Item code')?></th>
            <th width="60%" align="left"><?php echo __('Item name')?></th>
            <!--<th width="10%"><?php echo __('Price')?></th>
            <th width="10%"><?php echo __('Quantity')?></th>-->
            <th width="15%" align="right" nowrap="nowrap"><?php echo __('Price')?></th>
            <th width="5%"><?php echo __('Delete'); ?></th>
        </tr>
        <?php foreach ($arItems as $item):?>
            <tr>
                <td align="center"><?php echo $i++; ?></td>
                <td align="center">
                    <?php $product = ProductPeer::retrieveByPK($item->getObjId()); ?>
                    <?php echo $product->getCode() ?>
                </td>
                <!--<td align="center">
                    <?php $prod = ProductPeer::retrieveByPK($item->getObjId()); ?>
                    <?php if( $prod ):?>
                    <?php echo link_to(
                                    image_tag(
                                        'info.png'
                                        , array(
                                            'border' => '0'
                                            , 'alt' => __('info')
                                            , 'title' => __('info')
                                            , 'style' => 'margin: -2px;'
                                        )
                                    )
                                , 'product/show?id=' . $prod->getId()
                                   , array(
                                       'popup' => array(
                                           'popupWindow'
                                           , 'width=310,height=400,left=320,top=0'
                                        )
                                    )
                                ) ?>
                     <?php endif; ?>
                </td>-->
                <td align="left" nowrap="nowrap">
                   <?php if( $prod ):?>
                       <?php if(get_user_id()): ?>
                           <?php echo link_to($prod->getName()
                                               , 'pradmin/list?filters[id]=' . $prod->getId() . '&filter=1'
                                               )?>
                       <?php else: ?>
                            <?php echo link_to($prod->getName()
                                           , 'product/show?id=' . $prod->getId()
                                           )?>
                       <?php endif; ?>
                   </td>
                    <?php endif; ?>
                <!--<td align="center"><?php echo format_currency($item->getPriceByCurrencyCode($sf_user->getAttribute('currency', 'EUR')), $sf_user->getAttribute('currency', 'EUR')) ?></td>
                <td align="center">
                        <?php echo $item->getQuantity(); ?>
               </td>-->
                <td align="right" nowrap="nowrap"><?php echo format_currency($item->getPriceByCurrencyCode($sf_user->getAttribute('currency', 'EUR'))*$item->getQuantity(), $sf_user->getAttribute('currency', 'EUR')) ?></td>
                <td align="center">
                    <?php echo link_to(
                                    image_tag(
                                        'cross.png'
                                        , array(
                                            'border' => '0'
                                            , 'alt' => __('remove')
                                            , 'title' => __('remove')
                                        )
                                    )
                                    , 'cart/remove?id='.$item->getId()
                                ) ?>
                </td>
            </tr>
            
        <?php endforeach; ?>
    
        <tr>
            <th colspan="3"></th>
            <th align="right" nowrap="nowrap">
                <?php echo __('Total') ?>:&nbsp;&nbsp;<?php echo $receipt->getItemsQnt(); ?>&nbsp;&nbsp;&nbsp;<?php echo format_currency($receipt->getPriceByCurrencyCode($sf_user->getAttribute('currency', 'EUR')), $sf_user->getAttribute('currency', 'EUR')) ?>
            </th>
            <th></th>
        </tr>
        <tr>
        <?php /* @var $receipt Receipt */?>
            <th colspan="3">
                <?php echo __('Shipping') ?>:&nbsp;&nbsp;<?php echo format_currency($receipt->getShippingPriceMinor($sf_user->getAttribute('currency', 'EUR')), $sf_user->getAttribute('currency', 'EUR')) ?>
            </th>
            <th align="right" nowrap="nowrap">
                <?php echo __('Total') ?>:&nbsp;&nbsp;<?php echo format_currency($receipt->getPriceByCurrencyCode($sf_user->getAttribute('currency', 'EUR'))
                																+ $receipt->getShippingPriceMinor($sf_user->getAttribute('currency', 'EUR'))
                																, $sf_user->getAttribute('currency', 'EUR')) ?>
            </th>
            <th></th>
        </tr>

    </table>
<?php else: ?>
    <div class="title">
        <?php echo __('Cart was empty') ?>
    </div>
<?php endif; ?>

    </div>
</div>

<?php endif; ?>